from typing import *
from heapq import heappop, heappush


class Solution:
    def minimizeStringValue(self, s: str) -> str:
        cnt = Counter(s)
        q = []
        for i in range(26):
            c = chr(ord("a") + i)
            heappush(q, (cnt[c], c))
        h = [0] * 26
        for c in s:
            if c == "?":
                size, c = heappop(q)
                heappush(q, (size + 1, c))
                h[ord(c) - ord("a")] += 1
        ans = ""
        i = 0
        for c in s:
            if c == "?":
                while h[i] == 0:
                    i += 1
                h[i] -= 1
                c = chr(ord("a") + i)
            ans += c
        return ans


s = Solution()
print(s.minimizeStringValue("???"))
